{if condition="!$fsc->informe['started']"}
   {include="header"}
   
   <form action="{$fsc->url()}" method="post" class="form-inline">
      <div class="panel panel-info" style="margin: 5px;">
         <div class="panel-heading">
            <h3 class="panel-title">Opciones</h3>
         </div>
         <div class="panel-body">
            <div class="form-group">
               Comprobar
               <select class="form-control" name="modelo">
                  <option value="todo">Todo</option>
                  <option value="">-------</option>
                  <option value="asiento">Asientos</option>
                  <option value="factura cliente">Facturas de cliente</option>
                  <option value="factura proveedor">Facturas de proveedor</option>
                  <option value="albaran cliente"><span class="text-capitalize">{#FS_ALBARANES#}</span> de cliente</option>
                  <option value="albaran proveedor"><span class="text-capitalize">{#FS_ALBARANES#}</span> de proveedor</option>
               </select>
            </div>
            <div class="form-group">
               Hasta el ejercicio
               <select class="form-control" name="ejercicio">
                  {loop="$fsc->ejercicio->all()"}
                  <option value="{$value->codejercicio}">{$value->nombre}</option>
                  {/loop}
                  <option value="">---</option>
                  <option value="">Todos</option>
               </select>
            </div>
            <div class="form-group">
               <label>
                  <input type="checkbox" name="duplicados" value="TRUE"/>
                  Detectar duplicados
               </label>
            </div>
         </div>
         <div class="panel-footer">
            <button class="btn btn-sm btn-primary" type="submit" onclick="this.form.submit();">
               <span class="glyphicon glyphicon-eye-open"></span>
               &nbsp; Mostrar
            </button>
         </div>
      </div>
   </form>
   
   {include="footer"}
{elseif condition="!$fsc->ajax"}
   {include="header"}
   
   <script type="text/javascript">
      var show_page = "{$fsc->informe['show_page']}";
      var timeout = false;
      function load_errors(page)
      {
         show_page = page;
         $.ajax({
            type: 'POST',
            url: '{$fsc->url()}',
            dataType: 'html',
            data: 'ajax=TRUE&show_page='+show_page,
            success: function(datos) {
               clearTimeout(timeout);
               var re = /<!--(.*?)-->/g;
               var m = re.exec(datos);
               if(m[1] == 'FIN_PROCESO')
               {
                  $("#informe_errores").html(datos);
               }
               else if(m[1] == show_page)
               {
                  $("#informe_errores").html(datos);
                  timeout = setTimeout("load_errors(show_page);", 500);
               }
            }
         });
      }
      $(document).ready(function() {
         timeout = setTimeout("load_errors(show_page);", 500);
      });
   </script>
   
   <div id="informe_errores">
      <div class="alert alert-info" role="alert">Cargando...</div>
   </div>
   
   {include="footer"}
{else}
   {if condition="$fsc->informe['model']=='fin'"}
      <!--FIN_PROCESO-->
      <div class="alert alert-info" role="alert">Comprobación finalizada.</div>
   {else}
      <!--{$fsc->informe['show_page']}-->
      <div class="alert alert-info" role="alert">
         Comprobado hasta {$fsc->informe['model']} {$fsc->informe['offset']}...
         {$fsc->duration()}
      </div>
   {/if}
   
   <div class="table-responsive">
      <table class="table table-hover">
         <thead>
            <tr>
               <th class="text-left"></th>
               <th class="text-left">Modelo</th>
               <th class="text-left">Ejercicio</th>
               <th class="text-left">Identificador</th>
               <th class="text-right">Fecha</th>
            </tr>
         </thead>
         {loop="$fsc->errores"}
         <tr>
            <td>{if condition="$value.fix"}Corregido{else}-{/if}</td>
            <td>{$value.model}</td>
            <td>{$value.ejercicio}</td>
            <td><a href="{$value.url}">{$value.id}</a></td>
            <td class="text-right">{$value.fecha}</td>
         </tr>
         {else}
         <tr class="bg-warning">
            <td></td>
            <td colspan="4">Nada que mostrar.</td>
         </tr>
         {/loop}
      </table>
   </div>
   
   <div style="text-align: center;">
      <ul class="pagination">
      {loop="$fsc->all_pages()"}
         <li{if condition="$value.selected"} class="active"{/if}>
            <a href="{$fsc->url()}&show_page={$value.page}">{$value.num}</a>
         </li>
      {/loop}
      </ul>
   </div>
{/if}